//
//  WXPoiSearchTableViewCell.m
//  CarJX
//
//  Created by jxcl on 14-11-11.
//  Copyright (c) 2014年 KK. All rights reserved.
//

#import "WXPoiSearchTableViewCell.h"
#import "CLUIBaseViewController.h"

@implementation WXPoiSearchTableViewCell

- (IBAction)contectAction:(UIButton *)sender {
    if (self.target && self.contectSeletor && [self.target respondsToSelector:self.contectSeletor]) {
        [self.target performSelector:self.contectSeletor withObject:self.phoneLabel.text];
    }
}

- (IBAction)goHereAction:(UIButton *)sender {
    if (self.target && self.goHereSeletor && [self.target respondsToSelector:self.goHereSeletor]) {
        NSValue *ptValue = [NSValue value:&_pt withObjCType:@encode(CLLocationCoordinate2D)];  //封装坐标点
        [self.target performSelector:self.goHereSeletor withObject:ptValue];
    }
}

-(void)initPoiSearchTableViewCellInfo:(BMKPoiInfo*)info withTarget:(id)target contectSel:(SEL)contectSelector goHereSel:(SEL)goHereSelector
{
    self.nameLabel.text = info.name;
    self.adressLabel.text = info.address;
    self.phoneLabel.text = info.phone;
    self.target = target;
    self.pt = info.pt;
    self.contectSeletor = contectSelector;
    self.goHereSeletor = goHereSelector;
    if (info.phone == nil) {
        self.contectBtn.backgroundColor = [UIColor lightGrayColor];
        self.contectBtn.enabled = NO;
    }else{
        self.contectBtn.backgroundColor = UICOLOR_BUTTON;
        self.contectBtn.enabled = YES;
    }
}


- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
